//package com.cdsf.bms;
//
//import com.cdsf.basicmanage.area.domain.Area;
//import com.cdsf.basicmanage.dept.domain.Dept;
//import com.cdsf.basicmanage.user.domain.User;
//import org.apache.cxf.endpoint.Client;
//import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.stereotype.Service;
//
//import javax.annotation.PostConstruct;
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
//@Service
//public class BmsServiceImpl implements BmsService {
//    private static Client bmsClient;
//    @Value("${sys.bmsService}")
//    private String bmsUrl;
//
//    //@PostConstruct
//    private void getBmsClient() {
//        JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
//        bmsClient = dcf.createClient(bmsUrl + "?wsdl");
//    }
//
//    @Override
//    public User getUserById(String userId) throws Exception {
//        User user;
//        List<String> userIds = new ArrayList<>();
//        userIds.add(userId);
//        List<User> users = (List<User>) bmsClient.invoke("listUserById", userIds, null)[0];
//        if (users.size() > 0) {
//            user = users.get(0);
//        } else {
//            user = null;
//        }
//        return user;
//    }
//
//    @Override
//    public Dept getDeptById(String deptId) throws Exception {
//        // TODO Auto-generated method stub
////        return cache.getDeptById(deptId);
//        return null;
//    }
//
//    @Override
//    public Area getAreaById(String areaId) throws Exception {
//        // TODO Auto-generated method stub
////        return cache.getAreaById(areaId);
//        return null;
//    }
//
//    @Override
//    public List<Dept> listDept(Map<String, Object> map) throws Exception {
//        List<Dept> depts = (List<Dept>) bmsClient.invoke("listDept", bmsClient.invoke("getAccessUrls")[0])[0];
//        return depts;
//    }
//
//    @Override
//    public List<Area> listArea(Map<String, Object> map) throws Exception {
////        if (map.get("isTree") == null || "".equals(map.get("isTree"))) {
////            map.put("isTree", false);
////        }
////        map.put("isStandard", false);
////        map.put("queryDirect", "down");
////        return basicmanageService.listArea(map);
//        return null;
//    }
//
//    @Override
//    public List<User> listUser(List<String> userIds, String deptId) throws Exception {
//        // TODO Auto-generated method stub
////        return basicmanageService.listUserById(userIds, deptId);
//        return null;
//    }
//
//}
